/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gui;

import action.ToolbarAction;
import diagram.locations.AbsoluteLocation;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import model.ToolbarModel;

/**
 *
 * @author Jelle
 */
public class ToolbarPopup extends Popup {
    private JMenuItem m;
    private ToolbarModel tmodel;

    public ToolbarPopup(ToolbarModel tmodel) {
        this.tmodel = tmodel;
    }

    public void clearMenu() {
        getPopup().removeAll();
    }

    public void menuToolbar(AbsoluteLocation location, ToolbarModel tmodel) {
        clearMenu();      
        m = new JMenuItem(new ToolbarAction("add", location, tmodel));
        m.setText("Add new item");
        getPopup().add(m);
        getPopup().addSeparator();
        m = new JMenuItem(new ToolbarAction("clear", null, tmodel));
        m.setText("Remove All");
        getPopup().add(m);
    }

    public void menuToolbarItem(AbsoluteLocation location, ImageIcon icon) {
        clearMenu();
        m = new JMenuItem(new ToolbarAction());
        m.setText("Edit Item");
        getPopup().add(m);
        getPopup().addSeparator();
        //m = new JMenuItem(new ToolbarAction());
        m.setText("Delete Item");
        getPopup().add(m);
        m = new JMenuItem("Properties");
        getPopup().add(m);
    }
}
